\hypertarget{group__ethernet__api}{
\section{Ethernet\_\-api}
\label{group__ethernet__api}\index{Ethernet\_\-api@{Ethernet\_\-api}}
}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__ethernet__api_ga69a0b07b00606cde6460a005a465e4f9}{EthernetInitExpClk} (unsigned long ulBase, unsigned long ulEthClk)
\item 
void \hyperlink{group__ethernet__api_ga4fff12e564a12940c8241fa82d4c2f3b}{EthernetConfigSet} (unsigned long ulBase, unsigned long ulConfig)
\item 
unsigned long \hyperlink{group__ethernet__api_ga167d5b1f42772ba193b38a5a24992d72}{EthernetConfigGet} (unsigned long ulBase)
\item 
void \hyperlink{group__ethernet__api_ga8b99a7111e5f841039d99011d0d3b31a}{EthernetMACAddrSet} (unsigned long ulBase, unsigned char $\ast$pucMACAddr)
\item 
void \hyperlink{group__ethernet__api_gafdbc7b014f1415ccadb5fdc5b621df84}{EthernetMACAddrGet} (unsigned long ulBase, unsigned char $\ast$pucMACAddr)
\item 
void \hyperlink{group__ethernet__api_ga8acd35f723f93cbe8a2c8dae755a6d55}{EthernetEnable} (unsigned long ulBase)
\item 
void \hyperlink{group__ethernet__api_gaff9c56ef8e8550495838a480080e3795}{EthernetDisable} (unsigned long ulBase)
\item 
tBoolean \hyperlink{group__ethernet__api_gacb3100844829f61122fac46772892f8f}{EthernetPacketAvail} (unsigned long ulBase)
\item 
tBoolean \hyperlink{group__ethernet__api_ga48b7a86260108f39c0d2098663947b2b}{EthernetSpaceAvail} (unsigned long ulBase)
\item 
long \hyperlink{group__ethernet__api_gab36e318fdee23217b21d32845882ec2c}{EthernetPacketGetNonBlocking} (unsigned long ulBase, unsigned char $\ast$pucBuf, long lBufLen)
\item 
long \hyperlink{group__ethernet__api_gad072f06ac1a3e6e73035da175b7735a2}{EthernetPacketGet} (unsigned long ulBase, unsigned char $\ast$pucBuf, long lBufLen)
\item 
long \hyperlink{group__ethernet__api_gad9e08fadba00f7112a0c3f8c4f048c1b}{EthernetPacketPutNonBlocking} (unsigned long ulBase, unsigned char $\ast$pucBuf, long lBufLen)
\item 
long \hyperlink{group__ethernet__api_ga6edec2ea9fe3b985ab0cdcd7f0c9907a}{EthernetPacketPut} (unsigned long ulBase, unsigned char $\ast$pucBuf, long lBufLen)
\item 
void \hyperlink{group__ethernet__api_ga41fc8d47036f8d2bdb16284e2192826f}{EthernetIntRegister} (unsigned long ulBase, void($\ast$pfnHandler)(void))
\item 
void \hyperlink{group__ethernet__api_ga1d10f308e1809059d66d8c162b4dcf48}{EthernetIntUnregister} (unsigned long ulBase)
\item 
void \hyperlink{group__ethernet__api_ga46c0fb26c855d23011be05c164aae9d6}{EthernetIntEnable} (unsigned long ulBase, unsigned long ulIntFlags)
\item 
void \hyperlink{group__ethernet__api_ga88c4148bbdee1bd47dc86af402058aa3}{EthernetIntDisable} (unsigned long ulBase, unsigned long ulIntFlags)
\item 
unsigned long \hyperlink{group__ethernet__api_ga0b55e174a9d501dcae056df8cb100992}{EthernetIntStatus} (unsigned long ulBase, tBoolean bMasked)
\item 
void \hyperlink{group__ethernet__api_gaf29328bc223f631206a68f5981267474}{EthernetIntClear} (unsigned long ulBase, unsigned long ulIntFlags)
\item 
void \hyperlink{group__ethernet__api_gadcdfd3c0502e1a2de455c8645c3e924c}{EthernetPHYWrite} (unsigned long ulBase, unsigned char ucRegAddr, unsigned long ulData)
\item 
unsigned long \hyperlink{group__ethernet__api_ga48ccedbad61363cce6b634686c659c52}{EthernetPHYRead} (unsigned long ulBase, unsigned char ucRegAddr)
\end{DoxyCompactItemize}


\subsection{Function Documentation}
\hypertarget{group__ethernet__api_ga167d5b1f42772ba193b38a5a24992d72}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetConfigGet@{EthernetConfigGet}}
\index{EthernetConfigGet@{EthernetConfigGet}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetConfigGet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long EthernetConfigGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga167d5b1f42772ba193b38a5a24992d72}
Gets the current configuration of the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller.\end{DoxyParams}
This function will query the control registers of the Ethernet controller and return a bit-\/mapped configuration value.

\begin{DoxySeeAlso}{See also}
The description of the \hyperlink{group__ethernet__api_ga4fff12e564a12940c8241fa82d4c2f3b}{EthernetConfigSet()} function provides detailed information for the bit-\/mapped configuration values that will be returned.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
Returns the bit-\/mapped Ethernet controller configuration value. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga4fff12e564a12940c8241fa82d4c2f3b}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetConfigSet@{EthernetConfigSet}}
\index{EthernetConfigSet@{EthernetConfigSet}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetConfigSet}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetConfigSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulConfig}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga4fff12e564a12940c8241fa82d4c2f3b}
Sets the configuration of the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em ulConfig}]is the configuration for the controller.\end{DoxyParams}
After the \hyperlink{group__ethernet__api_ga69a0b07b00606cde6460a005a465e4f9}{EthernetInitExpClk()} function has been called, this API function can be used to configure the various features of the Ethernet controller.

The Ethernet controller provides three control registers that are used to configure the controller's operation. The transmit control register provides settings to enable full duplex operation, to auto-\/generate the frame check sequence, and to pad the transmit packets to the minimum length as required by the IEEE standard. The receive control register provides settings to enable reception of packets with bad frame check sequence values and to enable multi-\/cast or promiscuous modes. The timestamp control register provides settings that enable support logic in the controller that allow the use of the General Purpose Timer 3 to capture timestamps for the transmitted and received packets.

The {\itshape ulConfig\/} parameter is the logical OR of the following values:


\begin{DoxyItemize}
\item {\bfseries ETH\_\-CFG\_\-TS\_\-TSEN} -\/ Enable TX and RX interrupt status as CCP timer inputs
\item {\bfseries ETH\_\-CFG\_\-RX\_\-BADCRCDIS} -\/ Disable reception of packets with a bad CRC
\item {\bfseries ETH\_\-CFG\_\-RX\_\-PRMSEN} -\/ Enable promiscuous mode reception (all packets)
\item {\bfseries ETH\_\-CFG\_\-RX\_\-AMULEN} -\/ Enable reception of multicast packets
\item {\bfseries ETH\_\-CFG\_\-TX\_\-DPLXEN} -\/ Enable full duplex transmit mode
\item {\bfseries ETH\_\-CFG\_\-TX\_\-CRCEN} -\/ Enable transmit with auto CRC generation
\item {\bfseries ETH\_\-CFG\_\-TX\_\-PADEN} -\/ Enable padding of transmit data to minimum size
\end{DoxyItemize}

These bit-\/mapped values are programmed into the transmit, receive, and/or timestamp control register.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_gaff9c56ef8e8550495838a480080e3795}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetDisable@{EthernetDisable}}
\index{EthernetDisable@{EthernetDisable}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetDisable}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetDisable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_gaff9c56ef8e8550495838a480080e3795}
Disables the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller.\end{DoxyParams}
When terminating operations on the Ethernet interface, this function should be called. This function will disable the transmitter and receiver, and will clear out the receive FIFO.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga8acd35f723f93cbe8a2c8dae755a6d55}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetEnable@{EthernetEnable}}
\index{EthernetEnable@{EthernetEnable}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetEnable}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetEnable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga8acd35f723f93cbe8a2c8dae755a6d55}
Enables the Ethernet controller for normal operation.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller.\end{DoxyParams}
Once the Ethernet controller has been configured using the \hyperlink{group__ethernet__api_ga4fff12e564a12940c8241fa82d4c2f3b}{EthernetConfigSet()} function and the MAC address has been programmed using the \hyperlink{group__ethernet__api_ga8b99a7111e5f841039d99011d0d3b31a}{EthernetMACAddrSet()} function, this API function can be called to enable the controller for normal operation.

This function will enable the controller's transmitter and receiver, and will reset the receive FIFO.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga69a0b07b00606cde6460a005a465e4f9}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetInitExpClk@{EthernetInitExpClk}}
\index{EthernetInitExpClk@{EthernetInitExpClk}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetInitExpClk}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetInitExpClk (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulEthClk}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga69a0b07b00606cde6460a005a465e4f9}
Initializes the Ethernet controller for operation.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em ulEthClk}]is the rate of the clock supplied to the Ethernet module.\end{DoxyParams}
This function will prepare the Ethernet controller for first time use in a given hardware/software configuration. This function should be called before any other Ethernet API functions are called.

The peripheral clock will be the same as the processor clock. This will be the value returned by \hyperlink{group__sysctl__api_ga7fd64f17ef7b589c51d72df5837f13eb}{SysCtlClockGet()}, or it can be explicitly hard-\/coded if it is constant and known (to save the code/execution overhead of a call to \hyperlink{group__sysctl__api_ga7fd64f17ef7b589c51d72df5837f13eb}{SysCtlClockGet()}).

This function replaces the original EthernetInit() API and performs the same actions. A macro is provided in {\ttfamily \hyperlink{ethernet_8h_source}{ethernet.h}} to map the original API to this API.

\begin{DoxyNote}{Note}
If the device configuration is changed (for example, the system clock is reprogrammed to a different speed), then the Ethernet controller must be disabled by calling the \hyperlink{group__ethernet__api_gaff9c56ef8e8550495838a480080e3795}{EthernetDisable()} function and the controller must be reinitialized by calling the \hyperlink{group__ethernet__api_ga69a0b07b00606cde6460a005a465e4f9}{EthernetInitExpClk()} function again. After the controller has been reinitialized, the controller should be reconfigured using the appropriate Ethernet API calls.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_gaf29328bc223f631206a68f5981267474}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetIntClear@{EthernetIntClear}}
\index{EthernetIntClear@{EthernetIntClear}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetIntClear}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetIntClear (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulIntFlags}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_gaf29328bc223f631206a68f5981267474}
Clears Ethernet interrupt sources.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em ulIntFlags}]is a bit mask of the interrupt sources to be cleared.\end{DoxyParams}
The specified Ethernet interrupt sources are cleared so that they no longer assert. This must be done in the interrupt handler to keep it from being called again immediately upon exit.

The {\itshape ulIntFlags\/} parameter has the same definition as the {\itshape ulIntFlags\/} parameter to \hyperlink{group__ethernet__api_ga46c0fb26c855d23011be05c164aae9d6}{EthernetIntEnable()}.

\begin{DoxyNote}{Note}
Since there is a write buffer in the Cortex-\/M3 processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (since NVIC still sees the interrupt source asserted).
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga88c4148bbdee1bd47dc86af402058aa3}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetIntDisable@{EthernetIntDisable}}
\index{EthernetIntDisable@{EthernetIntDisable}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetIntDisable}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetIntDisable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulIntFlags}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga88c4148bbdee1bd47dc86af402058aa3}
Disables individual Ethernet interrupt sources.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em ulIntFlags}]is the bit mask of the interrupt sources to be disabled.\end{DoxyParams}
Disables the indicated Ethernet interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The {\itshape ulIntFlags\/} parameter has the same definition as the {\itshape ulIntFlags\/} parameter to \hyperlink{group__ethernet__api_ga46c0fb26c855d23011be05c164aae9d6}{EthernetIntEnable()}.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga46c0fb26c855d23011be05c164aae9d6}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetIntEnable@{EthernetIntEnable}}
\index{EthernetIntEnable@{EthernetIntEnable}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetIntEnable}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetIntEnable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulIntFlags}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga46c0fb26c855d23011be05c164aae9d6}
Enables individual Ethernet interrupt sources.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em ulIntFlags}]is the bit mask of the interrupt sources to be enabled.\end{DoxyParams}
Enables the indicated Ethernet interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The {\itshape ulIntFlags\/} parameter is the logical OR of any of the following:


\begin{DoxyItemize}
\item {\bfseries ETH\_\-INT\_\-PHY} -\/ An interrupt from the PHY has occurred. The integrated PHY supports a number of interrupt conditions. The PHY register, PHY\_\-MR17, must be read to determine which PHY interrupt has occurred. This register can be read using the \hyperlink{group__ethernet__api_ga48ccedbad61363cce6b634686c659c52}{EthernetPHYRead()} API function.
\item {\bfseries ETH\_\-INT\_\-MDIO} -\/ This interrupt indicates that a transaction on the management interface has completed successfully.
\item {\bfseries ETH\_\-INT\_\-RXER} -\/ This interrupt indicates that an error has occurred during reception of a frame. This error can indicate a length mismatch, a CRC failure, or an error indication from the PHY.
\item {\bfseries ETH\_\-INT\_\-RXOF} -\/ This interrupt indicates that a frame has been received that exceeds the available space in the RX FIFO.
\item {\bfseries ETH\_\-INT\_\-TX} -\/ This interrupt indicates that the packet stored in the TX FIFO has been successfully transmitted.
\item {\bfseries ETH\_\-INT\_\-TXER} -\/ This interrupt indicates that an error has occurred during the transmission of a packet. This error can be either a retry failure during the back-\/off process, or an invalid length stored in the TX FIFO.
\item {\bfseries ETH\_\-INT\_\-RX} -\/ This interrupt indicates that one (or more) packets are available in the RX FIFO for processing.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga41fc8d47036f8d2bdb16284e2192826f}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetIntRegister@{EthernetIntRegister}}
\index{EthernetIntRegister@{EthernetIntRegister}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetIntRegister}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetIntRegister (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{void($\ast$)(void)}]{ pfnHandler}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga41fc8d47036f8d2bdb16284e2192826f}
Registers an interrupt handler for an Ethernet interrupt.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em pfnHandler}]is a pointer to the function to be called when the enabled Ethernet interrupts occur.\end{DoxyParams}
This function sets the handler to be called when the Ethernet interrupt occurs. This will enable the global interrupt in the interrupt controller; specific Ethernet interrupts must be enabled via \hyperlink{group__ethernet__api_ga46c0fb26c855d23011be05c164aae9d6}{EthernetIntEnable()}. It is the interrupt handler's responsibility to clear the interrupt source.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__interrupt__api_ga471d00d73ae22faa426c202f608e9c69}{IntRegister()} for important information about registering interrupt handlers.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga0b55e174a9d501dcae056df8cb100992}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetIntStatus@{EthernetIntStatus}}
\index{EthernetIntStatus@{EthernetIntStatus}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetIntStatus}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long EthernetIntStatus (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{tBoolean}]{ bMasked}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga0b55e174a9d501dcae056df8cb100992}
Gets the current Ethernet interrupt status.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em bMasked}]is false if the raw interrupt status is required and true if the masked interrupt status is required.\end{DoxyParams}
This returns the interrupt status for the Ethernet controller. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

\begin{DoxyReturn}{Returns}
Returns the current interrupt status, enumerated as a bit field of values described in \hyperlink{group__ethernet__api_ga46c0fb26c855d23011be05c164aae9d6}{EthernetIntEnable()}. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga1d10f308e1809059d66d8c162b4dcf48}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetIntUnregister@{EthernetIntUnregister}}
\index{EthernetIntUnregister@{EthernetIntUnregister}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetIntUnregister}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetIntUnregister (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga1d10f308e1809059d66d8c162b4dcf48}
Unregisters an interrupt handler for an Ethernet interrupt.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller.\end{DoxyParams}
This function unregisters the interrupt handler. This will disable the global interrupt in the interrupt controller so that the interrupt handler no longer is called.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__interrupt__api_ga471d00d73ae22faa426c202f608e9c69}{IntRegister()} for important information about registering interrupt handlers.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_gafdbc7b014f1415ccadb5fdc5b621df84}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetMACAddrGet@{EthernetMACAddrGet}}
\index{EthernetMACAddrGet@{EthernetMACAddrGet}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetMACAddrGet}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetMACAddrGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned char $\ast$}]{ pucMACAddr}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_gafdbc7b014f1415ccadb5fdc5b621df84}
Gets the MAC address of the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em pucMACAddr}]is the pointer to the location in which to store the array of MAC-\/48 address octets.\end{DoxyParams}
This function will read the currently programmed MAC address into the {\itshape pucMACAddr\/} buffer.

\begin{DoxySeeAlso}{See also}
Refer to \hyperlink{group__ethernet__api_ga8b99a7111e5f841039d99011d0d3b31a}{EthernetMACAddrSet()} API description for more details about the MAC address format.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga8b99a7111e5f841039d99011d0d3b31a}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetMACAddrSet@{EthernetMACAddrSet}}
\index{EthernetMACAddrSet@{EthernetMACAddrSet}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetMACAddrSet}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetMACAddrSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned char $\ast$}]{ pucMACAddr}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga8b99a7111e5f841039d99011d0d3b31a}
Sets the MAC address of the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em pucMACAddr}]is the pointer to the array of MAC-\/48 address octets.\end{DoxyParams}
This function will program the IEEE-\/defined MAC-\/48 address specified in {\itshape pucMACAddr\/} into the Ethernet controller. This address is used by the Ethernet controller for hardware-\/level filtering of incoming Ethernet packets (when promiscuous mode is not enabled).

The MAC-\/48 address is defined as 6 octets, illustrated by the following example address. The numbers are shown in hexadecimal format.

AC-\/DE-\/48-\/00-\/00-\/80

In this representation, the first three octets (AC-\/DE-\/48) are the Organizationally Unique Identifier (OUI). This is a number assigned by the IEEE to an organization that requests a block of MAC addresses. The last three octets (00-\/00-\/80) are a 24-\/bit number managed by the OUI owner to uniquely identify a piece of hardware within that organization that is to be connected to the Ethernet.

In this representation, the octets are transmitted from left to right, with the ``AC'' octet being transmitted first and the ``80'' octet being transmitted last. Within an octet, the bits are transmitted LSB to MSB. For this address, the first bit to be transmitted would be ``0'', the LSB of ``AC'', and the last bit to be transmitted would be ``1'', the MSB of ``80''.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_gacb3100844829f61122fac46772892f8f}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetPacketAvail@{EthernetPacketAvail}}
\index{EthernetPacketAvail@{EthernetPacketAvail}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetPacketAvail}]{\setlength{\rightskip}{0pt plus 5cm}tBoolean EthernetPacketAvail (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_gacb3100844829f61122fac46772892f8f}
Check for packet available from the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller.\end{DoxyParams}
The Ethernet controller provides a register that contains the number of packets available in the receive FIFO. When the last bytes of a packet are successfully received (that is, the frame check sequence bytes), the packet count is incremented. Once the packet has been fully read (including the frame check sequence bytes) from the FIFO, the packet count will be decremented.

\begin{DoxyReturn}{Returns}
Returns {\bfseries true} if there are one or more packets available in the receive FIFO, including the current packet being read, and {\bfseries false} otherwise. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_gad072f06ac1a3e6e73035da175b7735a2}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetPacketGet@{EthernetPacketGet}}
\index{EthernetPacketGet@{EthernetPacketGet}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetPacketGet}]{\setlength{\rightskip}{0pt plus 5cm}long EthernetPacketGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned char $\ast$}]{ pucBuf, }
\item[{long}]{ lBufLen}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_gad072f06ac1a3e6e73035da175b7735a2}
Waits for a packet from the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em pucBuf}]is the pointer to the packet buffer. \item[{\em lBufLen}]is the maximum number of bytes to be read into the buffer.\end{DoxyParams}
This function reads a packet from the receive FIFO of the controller and places it into {\itshape pucBuf\/}. The function will wait until a packet is available in the FIFO. Then the function will read the entire packet from the receive FIFO. If there are more bytes in the packet than will fit into {\itshape pucBuf\/} (as specified by {\itshape lBufLen\/}), the function will return the negated length of the packet and the buffer will contain {\itshape lBufLen\/} bytes of the packet. Otherwise, the function will return the length of the packet that was read and {\itshape pucBuf\/} will contain the entire packet (excluding the frame check sequence bytes).

\begin{DoxyNote}{Note}
This function is blocking and will not return until a packet arrives.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns the negated packet length {\bfseries -\/n} if the packet is too large for {\itshape pucBuf\/}, and returns the packet length {\bfseries n} otherwise. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_gab36e318fdee23217b21d32845882ec2c}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetPacketGetNonBlocking@{EthernetPacketGetNonBlocking}}
\index{EthernetPacketGetNonBlocking@{EthernetPacketGetNonBlocking}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetPacketGetNonBlocking}]{\setlength{\rightskip}{0pt plus 5cm}long EthernetPacketGetNonBlocking (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned char $\ast$}]{ pucBuf, }
\item[{long}]{ lBufLen}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_gab36e318fdee23217b21d32845882ec2c}
Receives a packet from the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em pucBuf}]is the pointer to the packet buffer. \item[{\em lBufLen}]is the maximum number of bytes to be read into the buffer.\end{DoxyParams}
This function reads a packet from the receive FIFO of the controller and places it into {\itshape pucBuf\/}. If no packet is available the function will return immediately. Otherwise, the function will read the entire packet from the receive FIFO. If there are more bytes in the packet than will fit into {\itshape pucBuf\/} (as specified by {\itshape lBufLen\/}), the function will return the negated length of the packet and the buffer will contain {\itshape lBufLen\/} bytes of the packet. Otherwise, the function will return the length of the packet that was read and {\itshape pucBuf\/} will contain the entire packet (excluding the frame check sequence bytes).

This function replaces the original EthernetPacketNonBlockingGet() API and performs the same actions. A macro is provided in {\ttfamily \hyperlink{ethernet_8h_source}{ethernet.h}} to map the original API to this API.

\begin{DoxyNote}{Note}
This function will return immediately if no packet is available.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns {\bfseries 0} if no packet is available, the negated packet length {\bfseries -\/n} if the packet is too large for {\itshape pucBuf\/}, and the packet length {\bfseries n} otherwise. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga6edec2ea9fe3b985ab0cdcd7f0c9907a}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetPacketPut@{EthernetPacketPut}}
\index{EthernetPacketPut@{EthernetPacketPut}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetPacketPut}]{\setlength{\rightskip}{0pt plus 5cm}long EthernetPacketPut (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned char $\ast$}]{ pucBuf, }
\item[{long}]{ lBufLen}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga6edec2ea9fe3b985ab0cdcd7f0c9907a}
Waits to send a packet from the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em pucBuf}]is the pointer to the packet buffer. \item[{\em lBufLen}]is number of bytes in the packet to be transmitted.\end{DoxyParams}
This function writes {\itshape lBufLen\/} bytes of the packet contained in {\itshape pucBuf\/} into the transmit FIFO of the controller and then activates the transmitter for this packet. This function will wait until the transmit FIFO is empty. Once space is available, the function will return once {\itshape lBufLen\/} bytes of the packet have been placed into the FIFO and the transmitter has been started. The function will not wait for the transmission to complete. The function will return the negated {\itshape lBufLen\/} if the length is larger than the space available in the transmit FIFO.

\begin{DoxyNote}{Note}
This function blocks and will wait until space is available for the transmit packet before returning.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns the negated packet length {\bfseries -\/lBufLen} if the packet is too large for FIFO, and the packet length {\bfseries lBufLen} otherwise. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_gad9e08fadba00f7112a0c3f8c4f048c1b}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetPacketPutNonBlocking@{EthernetPacketPutNonBlocking}}
\index{EthernetPacketPutNonBlocking@{EthernetPacketPutNonBlocking}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetPacketPutNonBlocking}]{\setlength{\rightskip}{0pt plus 5cm}long EthernetPacketPutNonBlocking (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned char $\ast$}]{ pucBuf, }
\item[{long}]{ lBufLen}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_gad9e08fadba00f7112a0c3f8c4f048c1b}
Sends a packet to the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em pucBuf}]is the pointer to the packet buffer. \item[{\em lBufLen}]is number of bytes in the packet to be transmitted.\end{DoxyParams}
This function writes {\itshape lBufLen\/} bytes of the packet contained in {\itshape pucBuf\/} into the transmit FIFO of the controller and then activates the transmitter for this packet. If no space is available in the FIFO, the function will return immediately. If space is available, the function will return once {\itshape lBufLen\/} bytes of the packet have been placed into the FIFO and the transmitter has been started. The function will not wait for the transmission to complete. The function will return the negated {\itshape lBufLen\/} if the length is larger than the space available in the transmit FIFO.

This function replaces the original EthernetPacketNonBlockingPut() API and performs the same actions. A macro is provided in {\ttfamily \hyperlink{ethernet_8h_source}{ethernet.h}} to map the original API to this API.

\begin{DoxyNote}{Note}
This function does not block and will return immediately if no space is available for the transmit packet.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
Returns {\bfseries 0} if no space is available in the transmit FIFO, the negated packet length {\bfseries -\/lBufLen} if the packet is too large for FIFO, and the packet length {\bfseries lBufLen} otherwise. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga48ccedbad61363cce6b634686c659c52}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetPHYRead@{EthernetPHYRead}}
\index{EthernetPHYRead@{EthernetPHYRead}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetPHYRead}]{\setlength{\rightskip}{0pt plus 5cm}unsigned long EthernetPHYRead (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned char}]{ ucRegAddr}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga48ccedbad61363cce6b634686c659c52}
Reads from a PHY register.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em ucRegAddr}]is the address of the PHY register to be accessed.\end{DoxyParams}
This function will return the contents of the PHY register specified by {\itshape ucRegAddr\/}.

\begin{DoxyReturn}{Returns}
Returns the 16-\/bit value read from the PHY. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_gadcdfd3c0502e1a2de455c8645c3e924c}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetPHYWrite@{EthernetPHYWrite}}
\index{EthernetPHYWrite@{EthernetPHYWrite}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetPHYWrite}]{\setlength{\rightskip}{0pt plus 5cm}void EthernetPHYWrite (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned char}]{ ucRegAddr, }
\item[{unsigned long}]{ ulData}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_gadcdfd3c0502e1a2de455c8645c3e924c}
Writes to the PHY register.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller. \item[{\em ucRegAddr}]is the address of the PHY register to be accessed. \item[{\em ulData}]is the data to be written to the PHY register.\end{DoxyParams}
This function will write the {\itshape ulData\/} to the PHY register specified by {\itshape ucRegAddr\/}.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__ethernet__api_ga48b7a86260108f39c0d2098663947b2b}{
\index{ethernet\_\-api@{ethernet\_\-api}!EthernetSpaceAvail@{EthernetSpaceAvail}}
\index{EthernetSpaceAvail@{EthernetSpaceAvail}!ethernet_api@{ethernet\_\-api}}
\subsubsection[{EthernetSpaceAvail}]{\setlength{\rightskip}{0pt plus 5cm}tBoolean EthernetSpaceAvail (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase}
\end{DoxyParamCaption}
)}}
\label{group__ethernet__api_ga48b7a86260108f39c0d2098663947b2b}
Checks for packet space available in the Ethernet controller.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the controller.\end{DoxyParams}
The Ethernet controller's transmit FIFO is designed to support a single packet at a time. After the packet has been written into the FIFO, the transmit request bit must be set to enable the transmission of the packet. Only after the packet has been transmitted can a new packet be written into the FIFO. This function will simply check to see if a packet is in progress. If so, there is no space available in the transmit FIFO.

\begin{DoxyReturn}{Returns}
Returns {\bfseries true} if a space is available in the transmit FIFO, and {\bfseries false} otherwise. 
\end{DoxyReturn}
